gridpack::math::MatrixT< T, I > Class Template Reference

A parallel or serial matrix of real values. More...

#include <matrix.hpp>

Inheritance diagram for gridpack::math::MatrixT< T, I >:
Inheritance graph
[legend]
Collaboration diagram for gridpack::math::MatrixT< T, I >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef BaseMatrixInterface< T,
I >::TheType 
TheType
typedef BaseMatrixInterface< T,
I >::IdxType 
IdxType

Public Member Functions

 MatrixT (const parallel::Communicator &dist, const int &local_rows, const int &local_cols, const MatrixStorageType &storage_type=Sparse)
 Constructor.
 MatrixT (const parallel::Communicator &dist, const int &local_rows, const int &local_cols, const int &max_nz_per_row)
 Sparse matrix constructor with maximum number of nonzeros in a row.
 MatrixT (const parallel::Communicator &dist, const int &local_rows, const int &local_cols, const int *nz_by_row)
 Sparse matrix constructor with number of nonzeros for each row.
 MatrixT (MatrixImplementation< T, I > *impl)
 Construct with an existing (allocated) implementation.
 ~MatrixT (void)
 Destructor.
MatrixStorageType storageType (void) const
 Get the storage type of this matrix.
MatrixTclone (void) const
MatrixTlocalClone (void) const
void equate (const MatrixT &A)
 Get a part of the matrix (new instance allocated).
void multiplyDiagonal (const VectorT< T, I > &x)
 Multiply this matrix diagonal by the specified vector.
void addDiagonalVector (const VectorT< T, I > &x)
 Add the specified vector to the diagonal of this matrix.
void add (const MatrixT &A)
 Add another matrix to this one, in place.

Static Public Member Functions

static MatrixTcreateDense (const parallel::Communicator &comm, const int &global_rows, const int &global_cols, const int &local_rows, const int &local_cols)
 Create a Dense Matrix instance with more/less specific ownership.

Detailed Description

template<typename T, typename I = int>
class gridpack::math::MatrixT< T, I >

A parallel or serial matrix of real values.

This class uses the Pimpl idiom for implementation in order so the interface is completely free of the underlying library. If constructed with a parallel environment with only one process, a serial storage scheme is created, otherwise it's parallel.


Member Typedef Documentation

template<typename T, typename I = int>
typedef BaseMatrixInterface<T, I>::IdxType gridpack::math::MatrixT< T, I >::IdxType

The size/index type used.

Reimplemented from gridpack::math::BaseMatrixInterface< T, I >.

template<typename T, typename I = int>
typedef BaseMatrixInterface<T, I>::TheType gridpack::math::MatrixT< T, I >::TheType

The numeric type used.

Reimplemented from gridpack::math::BaseMatrixInterface< T, I >.


Constructor & Destructor Documentation

template<typename T, typename I = int>
gridpack::math::MatrixT< T, I >::MatrixT ( const parallel::Communicator dist,
const int &  local_rows,
const int &  local_cols,
const MatrixStorageType storage_type = Sparse 
)

Constructor.

A Matrix must be instantiated simulutaneously on all processes involved in the specified communicator. Each process in the communicator will own the number of rows requested.

Parameters:
dist parallel environment
local_rows matrix rows to be owned by the local process
local_cols matrix columns to be owned by the local process
storage_type specify dense or sparse storage
Returns:
template<typename T, typename I = int>
gridpack::math::MatrixT< T, I >::MatrixT ( const parallel::Communicator dist,
const int &  local_rows,
const int &  local_cols,
const int &  max_nz_per_row 
)

Sparse matrix constructor with maximum number of nonzeros in a row.

If the underlying math implementation supports it, this constructs a sparse matrix and pre-allocates it to allow max_nz_per_row nonzeros in each row. If the underlying math library supports it, max_nz_per_row does not need to be the same on all processors.

Parameters:
dist parallel environment
local_rows matrix rows to be owned by the local process
local_cols matrix columns to be owned by the local process
max_nz_per_row maximum number of nonzeros in a row
Returns:
new MatrixT
template<typename T, typename I = int>
gridpack::math::MatrixT< T, I >::MatrixT ( const parallel::Communicator dist,
const int &  local_rows,
const int &  local_cols,
const int *  nz_by_row 
)

Sparse matrix constructor with number of nonzeros for each row.

Parameters:
dist parallel environment
local_rows matrix rows to be owned by the local process
local_cols matrix columns to be owned by the local process
nz_by_row 
Returns:
template<typename T, typename I = int>
gridpack::math::MatrixT< T, I >::MatrixT ( MatrixImplementation< T, I > *  impl  ) 

Construct with an existing (allocated) implementation.

For internal use only.

Parameters:
impl 
Returns:

References gridpack::parallel::WrappedDistributed::WrappedDistributed().

template<typename T, typename I = int>
gridpack::math::MatrixT< T, I >::~MatrixT ( void   ) 

Destructor.

A matrix must be destroyed simulutaneously on all processes involved in the communicator used to instantiate it.


Member Function Documentation

template<typename T, typename I = int>
void gridpack::math::MatrixT< T, I >::add ( const MatrixT< T, I > &  A  ) 

Add another matrix to this one, in place.

Collective.

The specified matrix A must be the same global size (rows and columns) as this instance, but local ownership is not important, nor are any differences in nonzero entry patterns.

Parameters:
A matrix to add to this instance
template<typename T, typename I = int>
void gridpack::math::MatrixT< T, I >::addDiagonalVector ( const VectorT< T, I > &  x  ) 

Add the specified vector to the diagonal of this matrix.

Collective.

Parameters:
x 
template<typename T, typename I = int>
MatrixT* gridpack::math::MatrixT< T, I >::clone ( void   )  const

Make an exact replica of this instance Collective.

Returns:
pointer to new (allocated) matrix instance

References gridpack::math::MatrixT< T, I >::MatrixT().

template<typename T, typename I = int>
static MatrixT* gridpack::math::MatrixT< T, I >::createDense ( const parallel::Communicator comm,
const int &  global_rows,
const int &  global_cols,
const int &  local_rows,
const int &  local_cols 
) [static]

Create a Dense Matrix instance with more/less specific ownership.

Parameters:
comm 
stype 
global_rows 
global_cols 
local_rows 
local_cols 
Returns:
template<typename T, typename I = int>
void gridpack::math::MatrixT< T, I >::equate ( const MatrixT< T, I > &  A  ) 

Get a part of the matrix (new instance allocated).

Make this Matrix equal to another Collective.

Parameters:
A 
template<typename T, typename I = int>
MatrixT* gridpack::math::MatrixT< T, I >::localClone ( void   )  const
template<typename T, typename I = int>
void gridpack::math::MatrixT< T, I >::multiplyDiagonal ( const VectorT< T, I > &  x  ) 

Multiply this matrix diagonal by the specified vector.

Collective.

This is element by element multiplication

Parameters:
x factor by which all diagonal elements in the matrix are multiplied
template<typename T, typename I = int>
MatrixStorageType gridpack::math::MatrixT< T, I >::storageType ( void   )  const

Get the storage type of this matrix.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 3 Feb 2020 for GridPACK by  doxygen 1.6.1